package cn.lingyangwl.agile.common.datasource.core.handler;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * mybatis-plus的高级操作
 * @author shenguangyang
 */
@Component
public class MyMetaObjectHandler implements MetaObjectHandler {
    @Resource
    private List<EntityFieldFillHandler> entityFieldFillHandlerList;

    @Override
    public void insertFill(MetaObject metaObject) {
        entityFieldFillHandlerList.forEach(e -> e.insertFill(metaObject, this));
    }

    @Override
    public void updateFill(MetaObject metaObject) {
        entityFieldFillHandlerList.forEach(e -> e.updateFill(metaObject, this));
    }
}
